home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 117 / PC Guia 117.iso / Software / Produtividade / Software2 / Product4 / Setup.exe / drupal-4.6.0 / modules / help.module < prev    next >
Encoding:
Text File  |  2005-04-01  |  4.1 KB  |  110 lines

  1. <?php
  2. // $Id: help.module,v 1.45 2005/04/01 15:55:00 dries Exp $
  3.  
  4. /**
  5.  * @file
  6.  * Manages displaying online help.
  7.  */
  8.  
  9. /**
  10.  * Implementation of hook_menu().
  11.  */
  12. function help_menu($may_cache) {
  13.   $items = array();
  14.  
  15.   if ($may_cache) {
  16.     $items[] = array('path' => 'admin/help', 'title' => t('help'),
  17.       'callback' => 'help_main',
  18.       'access' => user_access('access administration pages'),
  19.       'weight' => 9);
  20.  
  21.     foreach (module_list() as $name) {
  22.       if (module_hook($name, 'help')) {
  23.         $items[] = array('path' => 'admin/help/' . $name,
  24.           'title' => t($name),
  25.           'callback' => 'help_page',
  26.     'type' => MENU_CALLBACK,
  27.           'access' => user_access('access administration pages'));
  28.       }
  29.     }
  30.   }
  31.  
  32.   return $items;
  33. }
  34.  
  35. /**
  36.  * Menu callback; prints a page listing a glossary of Drupal terminology.
  37.  */
  38. function help_main() {
  39.   $output = t("
  40.   <p>This guide explains what the various modules in <a href=\"%Drupal\">Drupal</a> do and how to configure them.</p>
  41.   <p>It is not a substitute for the <a href=\"%handbook\">Drupal handbook</a> available online and should be used in conjunction with it. The online reference handbook might be more up-to-date and has helpful user-contributed comments. It is your definitive reference point for all Drupal documentation.</p>
  42.   <h2>Help topics</h2>
  43.   <p>Help is available on the following items:</p>
  44.   %help_pages
  45.   <h2>Glossary of Drupal terminology</h2>
  46.   <dl>
  47.    <dt>Block</dt><dd>A small box containing information or content placed in the left-hand or right-hand sidebar of a web page.</dd>
  48.    <dt>Comment</dt><dd>A note attached to a node. Usually intended to clarify, explain, criticize, or express an opinion on the original material.</dd>
  49.    <dt>Moderation</dt>
  50.    <dd>The activity of making sure a post to a Drupal site fits in with what is expected for that Drupal site.
  51.     <dl>
  52.      <dt>Approved</dt><dd>A moderated post which has been accepted by the moderators for publication. (See published).</dd>
  53.      <dt>Waiting</dt><dd>A moderated post which is still being voted on to be accepted for publication. (See published.)</dd>
  54.     </dl>
  55.    </dd>
  56.    <dt>Node</dt><dd>The basic data unit in Drupal. Everything is a node or an extension of a node.</dd>
  57.    <dt>Public</dt><dd>See published.</dd>
  58.    <dt>Published</dt><dd>A node that is viewable by everyone. (See unpublished.)</dd>
  59.    <dt>Role</dt><dd>A classification users are placed into for the purpose of setting users' permissions.</dd>
  60.    <dt>Taxonomy</dt><dd>A division of a collection of things into ordered, classified groups. (See <a href=\"%taxonomy\">taxonomy help</a>.)</dd>
  61.    <dt>Unpublished</dt><dd>A node that is only viewable by administrators and moderators.</dd>
  62.    <dt>User</dt><dd>A person who has an account at your Drupal site, and is logged in with that account.</dd>
  63.    <dt>Visitor</dt><dd>A person who does not have an account at your Drupal site or a person who has an account at your Drupal site but is <strong>not</strong> logged in with that account. Also termed \"anonymous user\".</dd>
  64.   </dl>", array('%Drupal' => 'http://drupal.org', '%handbook' => 'http://drupal.org/handbook', '%help_pages' => help_links_as_list(), '%taxonomy' => url('admin/help/taxonomy')));
  65.  
  66.   print theme('page', $output);
  67. }
  68.  
  69. function help_links_as_list() {
  70.   $output = '<ul>';
  71.   foreach (module_list() as $name) {
  72.     if (module_hook($name, 'help')) {
  73.       if (module_invoke($name, 'help', "admin/help#$name")) {
  74.         $output .= '<li><a href="' . url("admin/help/$name") . '">' . t($name) . '</a></li>';
  75.       }
  76.     }
  77.   }
  78.   $output .= '</ul>';
  79.   return $output;
  80. }
  81.  
  82. /**
  83.  * Implementation of hook_help().
  84.  */
  85. function help_help($section) {
  86.   switch ($section) {
  87.     case 'admin/modules#description':
  88.       return t('Manages the display of online help.');
  89.   }
  90. }
  91.  
  92. /**
  93.  * Menu callback; prints a page listing general help for all modules.
  94.  */
  95. function help_page() {
  96.   $name = arg(2);
  97.   if (module_hook($name, 'help')) {
  98.     $temp = module_invoke($name, 'help', "admin/help#$name");
  99.     if (empty($temp)) {
  100.       $output .= t("No help is available for module %module.", array('%module' => $name));
  101.     }
  102.     else {
  103.       $output .= $temp;
  104.     }
  105.   }
  106.   print theme('page', $output);
  107. }
  108.  
  109. ?>
  110.